<template>
	<view>
		<view>
			<uni-nav-bar shadow left-icon="left" dark title="供应商列表" @clickLeft="back()" />
		</view>
		<uni-row >
			<uni-col :span="12"><uni-easyinput class="uni-mt-5" suffixIcon="search" v-model="SupplierForm.supplierCode"  placeholder="供应商编号" @iconClick="iconClick"></uni-easyinput></uni-col>
			<uni-col :span="12"><uni-easyinput class="uni-mt-5" suffixIcon="search" v-model="SupplierForm.supplierName" placeholder="供应商名称" @iconClick="iconClick"></uni-easyinput></uni-col>
		</uni-row>
		<view v-for="(item,index) in tableSupplier" :key="index">
			<uni-card>
			<uni-row >供应商编号:{{item.supplierCode}}</uni-row>
			<uni-row> 供应商名称:{{item.supplierName}}</uni-row>
			<uni-row> 联系人:{{item.contactPerson}}</uni-row>
			<uni-row> 联系电话:{{item.cellPhone}}</uni-row>
			<uni-row style="text-align: center;"><button type="primary" size="mini" @click="purchaser_list_detail(tableSupplier[index])">详细</button></uni-row>
			</uni-card>
		</view>
		
	</view>
</template>

<script>
	 import {datatableSupplier} from '@/api/system/user'
	export default {
		data() {
			return {
				tableSupplier:[],
				SupplierForm:{
					page: 1,
					rows:20,
					supplierCode:null,
					supplierName:null,
				},
			}
		},
		onLoad() {
			this.get()
		},
		
		methods: {
			iconClick(){
				this.get()
			},
			get(){
			  datatableSupplier(this.SupplierForm).then(res=>{
				
				  this.tableSupplier = res.rows
			  })
			},
			//返回上一层
			back(){
				this.$tab.reLaunch('/pages/work/purchaser/index')
			},
			//传递详细信息
			purchaser_list_detail(e){
				uni.navigateTo({
				       url: '/pages/work/purchaser/purchaser_list_detail',
				       success: (respost) => {
				           // 通过eventChannel向被打开页面传送数据
				           respost.eventChannel.emit('acceptDataFromOpenerPage', {data:e},
						   )}
				     });
			}
		}
	}
</script>

<style>

</style>
